<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" import="pacote1.*" errorPage="" %>
<%@ page import="BD.*" %>
<%@ page import="Utilitarios.*" %>
<%@ page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Série A - 2012</title>
<link type="text/css" rel="stylesheet" href="Css/tabela_main.css" />
</head>

<body>
	<% 	/*out.print("Pagina OK!"); 
		Connection con = ConexaoBanco.getConexao();
		Statement stm = con.createStatement();
		String sqlQuery = "INSERT INTO Equipes VALUES(1, 'SPORT', 'PE', 0, 0)";
		int ret = stm.executeUpdate(sqlQuery);
		System.out.println(ret);
		con.close();*/
	%>
    <%
		/*if(request.getParameter("valor") == null){
			Stack ss = new Stack();
			ss.push("ola");
			out.print(ss.pop());
	%>
    	<form>
        	Nome: <input type="text" name="valor" />
            <input type="submit" value="Send" />
        </form>
        
     <%
		}
		else{
				out.println(request.getParameter("valor"));
			}*/
	 %>
     
     <form>
     	Email: <input type="text" name="email" /><br />
        Nome: <input type="text" name="nome" /><br />
        Sobrenome: <input type="text" name="sobrenome" /><br />
        Senha: <input type="text" name="senha" /><br />
        Confirmação de Senha: <input type="text" name="confirmNome" /><br />
        <input type="submit" value="Cadastrar" />
     </form>
     <%
	 	String email = request.getParameter("email");
	 	if((request.getParameter("email") != null) || (request.getParameter("email") != "")){
			Login novoLogin = new Login(request.getParameter("nome"), request.getParameter("senha"));
			
			Connection con = ConexaoBanco.getConexao();
			Statement stm = con.createStatement();
			String sqlQuery = String.format("INSERT INTO Usuarios VALUES('%s', '%s', '%s', '%s', 0)", request.getParameter("email"), novoLogin.getUsuario(), request.getParameter("sobrenome"), novoLogin.getSenha());
			int ret = stm.executeUpdate(sqlQuery);
			System.out.println(ret);
			con.close();
		}
	 %>
</body>
</html>